describe('App.MoveToPayeeDetailListView', function() {
    var aView;
    beforeEach(function() {
        aView = App.MoveToPayeeDetailListView.create({
            controller: Ember.Object.create({
                transfer: Ember.Object.create({
                    biller: Ember.Object.create({
                    })
                })
            })
        });
    })
    describe('didInsertElement', function() {
        it('alphanumeric field', function() {
            aView.get('controller.transfer.biller').set('billerValidations', [{type: 'ALPHANUMERIC'}]);
            spyOn(aView, '_applyValidation');

            aView.didInsertElement();

            expect(aView._applyValidation).toHaveBeenCalledWith('alphanumeric');
        });
        it('alphanumeric field', function() {
            aView.get('controller.transfer.biller').set('billerValidations', [{type: 'NUMERIC'}]);
            spyOn(aView, '_applyValidation');

            aView.didInsertElement();

            expect(aView._applyValidation).toHaveBeenCalledWith('numeric');
        });
        it('no validation required', function() {
            aView.get('controller.transfer.biller').set('billerValidations', [{type: ''}]);
            spyOn(aView, '_applyValidation');

            aView.didInsertElement();

            expect(aView._applyValidation).not.toHaveBeenCalled();
        });
    });
    it('_applyValidation', function() {
        var field = {};
        spyOn(window, '$').andReturn(field);
        spyOn(BreezeUtils, 'applyInputValidation');

        aView._applyValidation('numeric');

        expect(BreezeUtils.applyInputValidation).toHaveBeenCalledWith(field, true, 'numeric');
    })
});